package _20;

import java.util.Scanner;

public class Test_People {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("请输入商品名称，价格和折扣率：");
        String name = in.next();
        double price = in.nextDouble();
        double discount = in.nextDouble();
        CheapGoods c = new CheapGoods(name, price, discount);
        System.out.println("商品名称：" + c.getName());
        System.out.println("商品原价：" + c.getPrice());
        System.out.println("折后价：" + c.getNewPrice());
    }
}

class Goods{
    protected String Name;
    protected double Price;
    public Goods(String name, double price){
        this.Name = name;
        this.Price = price;
    }

    public double getPrice() {
        return Price;
    }
}

class CheapGoods extends Goods{
    private double Price;
    private double Discount;
    public CheapGoods(String name, double price, double discount) {
        super(name, price);
        this.Discount = discount;
    }
    protected String getName(){
        return this.Name;
    }
    public double getNewPrice(){
        return this.Price = this.Discount*super.Price;
    }
}
